
// 实例化vue对象
var vue = new Vue({
    // element: 需要获取的元素,一定是html中的根容器元素
    el: "#vue-app",
    // data: 用于数据的存储
    data:{
        /*name:"MSTwu",
        job:"web开发",
        website:"http://www.thenewsstep.com",
        websiteTag:"<a href='http://www.thenewsstep.com'>Thenewstep</a>"*/
        age:30,
        x:0,
        y:0

    },
    // 用于存储各种方法
    methods:{
        /*greet:function (time) {
            return "Good "+time+", "+this.name+", "+this.job;
        }*/

        add:function (inc) {
          this.age+=inc;
        },

        minus:function (dec) {
            this.age-=dec;
        },
        
        updateXY:function (event) {
            // console.log(event);
            this.x = event.offsetX;
            this.y = event.offsetY;
        },
        stopMoving:function (event) {
            // JS阻止冒泡时间
            event.stopPropagation();
        },
        alert:function () {
            alert("hello world")
        }
    }
});

// data-binding : 给属性绑定对应的值